<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
    <script src="{{ URL::asset('js/ckeditor/ckeditor.js') }}"></script>
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>Document</title>
</head>
<body>
    <h1>fuck cke</h1>    
    <form>
        <textarea name="editor1" id="editor1" rows="10" cols="80">
            This is my textarea to be replaced with CKEditor.
        </textarea>
        <script>
            // Replace the <textarea id="editor1"> with a CKEditor
            // instance, using default configuration.
            // CKEDITOR.replace( 'editor1' );
            customToolbar:
                [
                { name: 'tools', items : [ 'Maximize', 'ShowBlocks','-', 'Attachments' ] }
                ]

            CKEDITOR.replace('editor1',
            { extraPlugins: 'attach',
                toolbar: this.customToolbar,
                filebrowserUploadUrl: "{{ url('file/uploadfile') }}", 
                autoCloseUpload: true, //autoClose attachment container on attachment upload
                validateSize: 100, //100mb size limit
                on: {
                    onAttachmentUpload: function(response) {
                    /*
                    the following code just utilizes the attachment upload response to generate 
                    ticket-attachment on your page
                    */
                    attachment_id = $(response).attr('data-id');
                    if (attachment_id) {
                        attachment = $(response).html();
                        $closeButton = $('<span class="attachment-close">').text('x').on('click', closeButtonEvent)
                        $('.ticket-attachment-container').show()
                        .append($('<div>', { class: 'ticket-attachment' }).html(attachment).append($closeButton))
                        .append($('<input>', { type: 'hidden', name: 'attachment_ids[]' }).val(attachment_id)
                        );
                        }
                    }
                    }
                });
        </script>
    </form>
</body>
</html>